package com.oig.sys.file.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.oig.common.validator.GroupAdd;
import com.oig.common.validator.GroupEdit;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Schema
@Data
public class FileInfoDto {


    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "参数错误,id不能为空", groups= GroupEdit.class)
    private Integer id;


//    @Schema(description = "应用id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
//    @NotNull(message = "参数错误,应用id不能为空", groups= {GroupAdd.class, GroupEdit.class})
//    private Integer systemId;
//
//    @Schema(description = "应用名称")
//    private String systemName;

    /**
     * 主业务类型 一个类型代表一种可以单独结算的业务单据
     *      * 01-代理（主单号是订单号）
     *      * 02-仓储（主单号是入库单号）
     *      * 03-运输（主单号是运单号）
     */
    @Schema(description = "主业务类型,01-代理 02-仓储 03-运输", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,单据类型不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String businessType;

    @Schema(description = "主业务单号,代理（主单号是订单号）仓储（主单号是入库单号）运输（主单号是运单号）", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    //@NotEmpty(message = "参数错误,主业务单号不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String businessOrderId;

    /**
     * 用自定义枚举定义单据类型
     */
    @Schema(description = "单据类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,单据类型不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String relationType;

    @Schema(description = "业务单号")
    //@NotEmpty(message = "参数错误,业务单号不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String relationId;

    /**
     * 业务附件类型
     */
    @Schema(description = "业务附件类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,业务附件类型不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String formalType;

    /**
     * 文件类型
     */
    @Schema(description = "文件类型")
    private String fileType;

    @Schema(description = "文件id，相对路径", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,文件id，相对路径不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String fileId;

    @Schema(description = "原文件名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,原文件名称不能为空", groups= {GroupAdd.class, GroupEdit.class})
    private String fileName;

    @Schema(description = "文件url，完整路径")
    private String fileUrl;

    @Schema(description = "业务编码,文件里本身的业务号")
    private String fileNumber;
    @Schema(description = "是否允许客户端下载 0-否 1-是 默认1")
    private String downloadFlag;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "收到日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date fileRevTime;

    @Schema(description = "所属租户id")
    private Integer tenantId;
    @Schema(description = "所属租户名称")
    private String tenantName;


    @Schema(description = "文件上传人ID")
    private Integer fileUploadId;
    @Schema(description = "文件上传人编码")
    private String fileUploadCode;
    @Schema(description = "文件上传人")
    private String fileUploadName;
    @Schema(description = "文件上传时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date fileUploadTime;

    @Schema(description = "创建人ID")
    private Integer createId;
    @Schema(description = "创建人编码")
    private String createCode;
    @Schema(description = "创建人")
    private String createName;
    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(description = "最后更新人ID")
    private Integer lastUpdateId;
    @Schema(description = "最后更新人编码")
    private String lastUpdateCode;
    @Schema(description = "最后更新人")
    private String lastUpdateName;
    @Schema(description = "最后更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastUpdateTime;


    @Schema(description = "状态")
    private String status;

}
